#include "ksettingutils.h"

//枚举 → 字符串
QString shapeTypeToString(KShapeType type)
{
	switch (type) {
	case KShapeType::MouseShapeType: return "Mouse";
	case KShapeType::FreeHandShapeType: return "FreeHand";
	case KShapeType::LineShapeType: return "Line";
	case KShapeType::RectShapeType: return "Rect";
	case KShapeType::EllipseShapeType: return "Ellipse";
	case KShapeType::StarShapeType: return "Star";
	case KShapeType::TextShapeType: return "Text";
	case KShapeType::ZoomInShapeType: return "ZoomIn";
	case KShapeType::ZoomOutShapeType: return "ZoomOut";
	case KShapeType::PentagonShapeType: return "Pentagon";
	case KShapeType::RhombusShapeType: return "Rhombus";
	case KShapeType::CloudShapeType: return "Cloud";
	case KShapeType::HeartShapeType: return "Heart";
    case KShapeType::HexagonShapeType: return "Hexagon";
    default: return "Unknown";
    }
}

//字符串 → 枚举
KShapeType stringToShapeType(const QString& str)
{
    if (str == "Mouse") return KShapeType::MouseShapeType;
    if (str == "FreeHand") return KShapeType::FreeHandShapeType;
    if (str == "Line") return KShapeType::LineShapeType;
    if (str == "Rect") return KShapeType::RectShapeType;
    if (str == "Ellipse") return KShapeType::EllipseShapeType;
    if (str == "Star") return KShapeType::StarShapeType;
    if (str == "Text") return KShapeType::TextShapeType;
    if (str == "ZoomIn") return KShapeType::ZoomInShapeType;
    if (str == "ZoomOut") return KShapeType::ZoomOutShapeType;
    if (str == "Pentagon") return KShapeType::PentagonShapeType;
    if (str == "Rhombus") return KShapeType::RhombusShapeType; 
    if (str == "Cloud") return KShapeType::CloudShapeType;  
    if (str == "Heart") return KShapeType::HeartShapeType; 
    if (str == "Hexagon") return KShapeType::HexagonShapeType; 
    return KShapeType::MouseShapeType; // 默认返回 MouseShapeType
}
